package com.hong.chapter3;

/**
 * Created by hong on 2018/5/30.
 *这程帅跟病毒一样，一下子就挂了。电脑卡死
 */
public class CreateThread5 {
    private static int counter = 1;

    public static void main(String[] args){
        try {
            for (int i=0;i<Integer.MAX_VALUE;i++){
                counter++;
                new Thread(new Runnable() {
                    @Override
                    public void run() {
                        while (true){
                            try {
                                Thread.sleep(1);
                            }catch (InterruptedException e){
                                e.printStackTrace();
                            }
                        }
                    }
                }).start();
            }
        }catch (Error e){

        }
            System.out.println("Total created thread nums=>"+counter);
    }
}
